package com.fire.market.order.service.impl;

import com.fire.component.dto.SingleResponse;
import com.fire.component.utils.code.CodeUtil;
import com.fire.market.order.api.request.OrderCreateParam;
import com.fire.market.order.api.result.OrderTokenResult;
import com.fire.market.order.api.service.OrderQueryFrontService;
import com.fire.market.order.service.OrderQueryCoreService;
import org.apache.dubbo.config.annotation.Service;

import javax.annotation.Resource;

/**
 * OrderQueryFrontServiceImpl
 *
 * @author zwd
 * @date 2021/7/21
 */
@Service
public class OrderQueryFrontServiceImpl implements OrderQueryFrontService {
    @Resource
    OrderQueryCoreService orderQueryCoreService;

    @Override
    public SingleResponse<String> queryPromoToken(OrderCreateParam param) {
        return SingleResponse.of(orderQueryCoreService.queryPromoToken(param));
    }

    @Override
    public SingleResponse<OrderTokenResult> generateToken(String userId) {
        OrderTokenResult orderTokenResult = new OrderTokenResult();
        orderTokenResult.setTokenParam(CodeUtil.generateCodeAndPic());
        return SingleResponse.of(orderTokenResult);
    }
}
